package com.lm.controller;

import com.lm.pojo.ServiceItem;
import com.lm.service.ServiceItemService;
import com.lm.util.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 15833
 * @version 1.0
 * @description: TODO 服务项目管理
 * @date 2025/9/23 9:18
 */
@CrossOrigin(origins = "*")
@Api(tags = "服务项目管理")
@RestController
@RequestMapping("/serviceItem")
public class ServiceItemController {

    //注入serviceItemService接口
    @Autowired
     private ServiceItemService serviceItemService;

    /**
     * @description: 查找服务项目列表
     * @param: null
     * @return:
     * @author 15833
     * @date: 2025/9/23 9:27
     */
    @ApiOperation(value = "查找所有服务服务项目", httpMethod = "POST", notes = "查找所有服务项目")
    @PostMapping("findServiceItemList")
    public ResultUtil<List<ServiceItem>> findServiceItemList(@RequestBody ServiceItem serviceItem){
        try {
            return new ResultUtil<>(200,"服务项目查询成功",serviceItemService.findServiceItemList(serviceItem));
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultUtil<>(500,"服务项目查询失败");
        }
    }
}
